package edu.unf.cen6940.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllResearchkeywords", query = "select myResearchkeyword from Researchkeyword myResearchkeyword"),
		@NamedQuery(name = "findResearchkeywordByKeyword", query = "select myResearchkeyword from Researchkeyword myResearchkeyword where myResearchkeyword.keyword = ?1"),
		@NamedQuery(name = "findResearchkeywordByKeywordContaining", query = "select myResearchkeyword from Researchkeyword myResearchkeyword where myResearchkeyword.keyword like ?1"),
		@NamedQuery(name = "findResearchkeywordByPrimaryKey", query = "select myResearchkeyword from Researchkeyword myResearchkeyword where myResearchkeyword.researchKeywordId = ?1"),
		@NamedQuery(name = "findResearchkeywordByResearchKeywordId", query = "select myResearchkeyword from Researchkeyword myResearchkeyword where myResearchkeyword.researchKeywordId = ?1") })
@Table(catalog = "ThesisManagement", name = "ResearchKeyword")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "rms_test/edu/unf/cen6940/domain", name = "Researchkeyword")
public class Researchkeyword implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "researchKeywordID", nullable = false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer researchKeywordId;
	/**
	 */

	@Column(name = "keyword", length = 150, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String keyword;

	/**
	 */
	@ManyToMany(mappedBy = "researchkeywords", fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Facultyresearch> facultyresearchs;

	/**
	 */
	public void setResearchKeywordId(Integer researchKeywordId) {
		this.researchKeywordId = researchKeywordId;
	}

	/**
	 */
	public Integer getResearchKeywordId() {
		return this.researchKeywordId;
	}

	/**
	 */
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	/**
	 */
	public String getKeyword() {
		return this.keyword;
	}

	/**
	 */
	public void setFacultyresearchs(Set<Facultyresearch> facultyresearchs) {
		this.facultyresearchs = facultyresearchs;
	}

	/**
	 */
	public Set<Facultyresearch> getFacultyresearchs() {
		if (facultyresearchs == null) {
			facultyresearchs = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Facultyresearch>();
		}
		return facultyresearchs;
	}

	/**
	 */
	public Researchkeyword() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Researchkeyword that) {
		setResearchKeywordId(that.getResearchKeywordId());
		setKeyword(that.getKeyword());
		setFacultyresearchs(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Facultyresearch>(that.getFacultyresearchs()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("researchKeywordId=[").append(researchKeywordId).append("] ");
		buffer.append("keyword=[").append(keyword).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((researchKeywordId == null) ? 0 : researchKeywordId.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Researchkeyword))
			return false;
		Researchkeyword equalCheck = (Researchkeyword) obj;
		if ((researchKeywordId == null && equalCheck.researchKeywordId != null) || (researchKeywordId != null && equalCheck.researchKeywordId == null))
			return false;
		if (researchKeywordId != null && !researchKeywordId.equals(equalCheck.researchKeywordId))
			return false;
		return true;
	}
}
